package org.jsea.meta.api.bean;

import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * --.
 * *
 * author   Jiang.hy
 * create   2022-04-24
 */
@Setter
@Getter
public class MetaApiField {

    private String name;

    private String alias;

    private boolean compile = true;

    public MetaApiField(String name) {
        this.name = name;
    }

    public MetaApiField(String name, String alias) {
        this.name = name;
        this.alias = alias;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MetaApiField that = (MetaApiField) o;
        return Objects.equals(name, that.name) && Objects.equals(alias, that.alias);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, alias);
    }

    @Override
    public String toString() {
        return name + (alias == null ? "" : ":" + alias);
    }
}
